//PITCH PROGRAM
//CLASS: Deck
//	-methods to shuffle and deal deck 
//BY: Alex Tracy
import java.util.Random;

public class Deck 
{
	private final int NUMBER_OF_CARDS = 52;//number of cards in deck
	public final Random randomNumbers = new Random();//Random Generator
	private int deck[] = new int[NUMBER_OF_CARDS];//deck of cards


	//Deck Constructor
	//Initialize deck of cards by setting each card to a number
	//0 - 51
	public Deck ()
	{
		for ( int i = 0 ; i < 52 ; i ++)
		{
			deck[i] = i;
		}
	}//End Deck Constructor
	
	//shuffle
	//Shuffle the Cards by picking a random card and switching
	//the cards place in the deck
	public void shuffle()
	{
		for (int first = 0; first < deck.length ; first++)
		{
			//for each card pick another random card and swap
			int second = randomNumbers.nextInt(NUMBER_OF_CARDS);
			
			//swap current card with random card
			int temp = deck[first];
			deck[first] = deck[second];
			deck[second] = temp;
		}
	}//End Shuffle()
	
	
	//getVALUE
	//get numerical value of card
	public int getValue(int c)
	{
		return deck[c];
	}//End getValue
	
	//deal
	//Deal Cards to each player 1 at a time 
	//until all players hands are full
	public void deal(Player p[])
	{
		int deckCount = 0;
		for (int i = 0 ; i < 6; i++)
		{
				for (int j = 0 ; j < p.length ; j++)
				
					p[j].setHand(i, deck[deckCount++]);
		}
	}//End Deal
	
}//End Deck Class
